package com.surfilter.risk.enums;

/**
 * CompRiskEnum
 * Dis:
 * Created by grom on 2017/5/18.
 */
public enum CompRiskEnum {
    HIGH(3,5),
    AVERAGE(2,3),
    LOW(1,1);

    private int state;
    private int stateInfo;

    //枚举类型的构造器应该是私有的
    private CompRiskEnum(int state, int stateInfo) {
        this.state = state;
        this.stateInfo = stateInfo;
    }

    public int getState() {
        return state;
    }

    public int getStateInfo() {
        return stateInfo;
    }

    public static CompRiskEnum stateOf(int index){
        for(CompRiskEnum compRiskEnum : values()){
            if(compRiskEnum.getState() == index){
                return compRiskEnum;
            }
        }
        return null;
    }
}
